"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var fs_1 = require("fs");
var path_1 = require("path");
// 实现日志记录的类（输出到控制台）
var ConsoleLogger = /** @class */ (function () {
    function ConsoleLogger() {
    }
    ConsoleLogger.prototype.log = function (message) {
        console.log("Log: ".concat(message));
    };
    return ConsoleLogger;
}());
// 实现日志记录的类
var FileLogger = /** @class */ (function () {
    function FileLogger() {
    }
    FileLogger.prototype.log = function (message) {
        fs_1.default.writeFileSync(path_1.default.resolve(__dirname, '../data/audio.ass'), message);
    };
    return FileLogger;
}());
// 依赖关系：一个类依赖于另一个类的接口
var UserManager = /** @class */ (function () {
    function UserManager(logger) {
        this.logger = logger;
    }
    UserManager.prototype.addUser = function (username) {
        // 执行一些操作
        this.logger.log("User '".concat(username, "' added."));
    };
    return UserManager;
}());
// 使用依赖关系
var consoleLogger = new ConsoleLogger();
var userManager = new UserManager(consoleLogger);
userManager.addUser('Alice');
// const fileLogger = new FileLogger();
// const userManagerV2 = new UserManager(fileLogger);
